Key EPContext cache by compile identity - #1295
Open
Qiong Wu (qiowu) (DingmaomaoBJTU) wants to merge 1 commit into
Open
Key EPContext cache by compile identity#1295Qiong Wu (qiowu) (DingmaomaoBJTU) wants to merge 1 commit into
Qiong Wu (qiowu) (DingmaomaoBJTU) wants to merge 1 commit into
Conversation
Qiong Wu (qiowu) (DingmaomaoBJTU)
requested a review
from a team
as a code owner
August 9, 2026 00:47
| ep_device=ep_device, | ||
| ep_config=ep_config, | ||
| ) | ||
| running_model_path = model_path |
|
|
||
| if TYPE_CHECKING: | ||
| from pathlib import Path | ||
| import onnx |
| onnx_path=simple_matmul_onnx, | ||
| ep_device=qnn_npu_ep_device, | ||
| ep_config=EPConfig(provider="qnn", enable_ep_context=True), | ||
| session_options=lambda: MagicMock(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WinMLSessionmtime-only EPContext reuse with a strict compile identityProblem
WinMLSession.compile()previously reused<model>_<device>_ctx.onnxwhenever it was newer than the source ONNX. The cache key omitted the EP/source/version, hardware, provider/session options, embed mode, ORT version, external-data sidecars, and context binary integrity. Different configurations could therefore reuse or overwrite one shared EPContext artifact.Behavior
SessionOptionsand uncertain source identity use unique non-cacheable generationsValidation
Using cached EPContextmodel_qnn_ctx.onnxreferencesmodel_qnn_ctx_qnn.<sha256>.binmodel_qnn_ctx_qnn.binalias remains present with matching sizeuv lock --offline --checkcould not resolve uncached Linuxonnxmetadata on this ARM64 host. The lockfile TOML parses and the added unit test verifies that every direct project dependency is represented in both the editable package dependencies andrequires-distmetadata; CI runs on the supported AMD64 environment.